﻿using TalentDesk.Contracts.Ef;
using TalentDesk.Mvc.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;

namespace TalentDesk.Mvc.HelperClasses
{
    public static class HtmlHelperExtensions
    {
        //public static MvcHtmlString GetEnumDescription(this HtmlHelper htmlHelper, Type enumType, MvcHtmlString value)
        //{
        //    if (string.IsNullOrEmpty(value.ToString()))
        //        return MvcHtmlString.Create(string.Empty);

        //    FieldInfo fi;
        //    DescriptionAttribute da;
        //    foreach (var enumValue in Enum.GetValues(enumType))
        //    {
        //        if (Convert.ToInt32(enumValue) == Convert.ToInt32(value.ToString()))
        //        {
        //            fi = enumType.GetField((enumValue.ToString()));
        //            da = (DescriptionAttribute)Attribute.GetCustomAttribute(fi,
        //            typeof(DescriptionAttribute));
        //            if (da != null)
        //            {
        //                return MvcHtmlString.Create(da.Description);
        //            }
        //        }
        //    }
        //    return MvcHtmlString.Create(string.Empty);
        //}

        //public static MvcHtmlString GetTaliTarifeAdi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetTaliTarifeAdi(Convert.ToInt32(key.ToString())));
        //}
        //public static MvcHtmlString GetUnipedeAdi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetUnipedeAdi(key.ToString()));
        //}

        //public static MvcHtmlString GetBankaAdi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Create("Yok");
        //    if (string.IsNullOrEmpty(key.ToString().Trim()))
        //        return MvcHtmlString.Create("Yok");
        //    return MvcHtmlString.Create(CacheHelper.GetBankaAdi(key.ToString()));
        //}

        //public static MvcHtmlString GetIsletmeKodu(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetIsletmeKodu(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetSayacMarkaAdi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetSayacMarkaAdi(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetSayacEnerjiOlcumCinsi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetSayacEnerjiOlcumCinsi(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetSayacZaman(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetSayacZaman(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetFizikselDurumAciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetFizikselDurumAciklama(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetHareketTipiAciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetHareketTipiAciklama(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetTrafoMarkasi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetTrafoMarkasi(Convert.ToInt32(key.ToString())));
        //}
        //public static MvcHtmlString GetTahakkukKalemAdi(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetThkKalemAciklama(Convert.ToInt32(key.ToString())));
        //}
        //public static MvcHtmlString GetThsTurkod01Aciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetThsTurleri01Aciklama(Convert.ToInt32(key.ToString())));
        //}
        //public static MvcHtmlString GetThsTurkod02Aciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetThsTurleri02Aciklama(Convert.ToInt32(key.ToString())));
        //}

        //public static MvcHtmlString GetKacakDurumAciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return htmlHelper.GetEnumDescription(typeof(EnumKacakKayitDurum), key);
        //}
        //public static MvcHtmlString GetKacakTuru(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    string result = string.Empty;
        //    if (!string.IsNullOrEmpty(key.ToString()))
        //        result = CacheHelper.GetKacakTuru(Convert.ToInt32(key.ToString()));
        //    return MvcHtmlString.Create(result);
        //}

        //public static MvcHtmlString GetAnaAboneGrubu(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    string result = string.Empty;
        //    if (!string.IsNullOrEmpty(key.ToString()))
        //        result = CacheHelper.GetAnaAboneGrubu(Convert.ToInt32(key.ToString()));
        //    return MvcHtmlString.Create(result);
        //}


        ////Bu kısım sedaş için yazıldı orada şuan cache yapısı yok eklendiğin de değiştirilebilinir
        //public static MvcHtmlString GetBilgilendirmeTuruAciklama(this HtmlHelper htmlHelper, MvcHtmlString key)
        //{
        //    if (string.IsNullOrEmpty(key.ToString()))
        //        return MvcHtmlString.Empty;
        //    return MvcHtmlString.Create(CacheHelper.GetBilgilendirmeTuruAciklama(Convert.ToInt32(key.ToString())));
        //}

    }
}